define(['./../initial'], function() {
    var app = angular.module('App.home');
    app.factory('chartsFactory', ['$http', '$q', 'mapInstance', 'defineTheme', '$rootScope', '$timeout', '$compile',
        function($http, $q, mapInstance, defineTheme, $rootScope, $timeout, $compile) {
            var botoomBar_height = -1;
            //制保留2位小数，如：2，会在2后面补上00.即2.00  
            function toDecimal2(x) {
                var f = Math.round(x * 100) / 100;
                var s = f.toString();
                var rs = s.indexOf('.');
                if (rs < 0) {
                    rs = s.length;
                    s += '.';
                }
                while (s.length <= rs + 2) {
                    s += '0';
                }
                return s;
            }

            var fac = {
                botoomBarHeight: function() {
                    if (botoomBar_height > 0) {

                    } else {
                        botoomBar_height = $('#bottomBar').height() - $('#bottomBar .ng-isolate-scope').first().height();
                    }
                    return botoomBar_height;
                },
                destroy: function(domId) {
                    var chart = $(domId).highcharts();
                    if (chart) {
                        chart.destroy();
                    }
                },
                createAutoSurveyAllLastValues: function(domId, data) {
                    var defer = $q.defer();
                    var dom = $(domId);
                    var chart = dom.highcharts();
                    if (chart) {
                        chart.destroy();
                    }
                    defineTheme.dark();
                    $(domId).highcharts({
                        chart: {
                            height: botoomBar_height,
                            type: 'line',
                            borderColor: "transparent",
                            width: dom.width() ? dom.width() : document.body.clientWidth,
                            style: {
                                fontFamily: '"Microsoft Yahei", Verdana', // default font
                                fontSize: '11px'
                            },
                            spacingLeft: 3,
                            marginTop: 6,
                            spacingRight: 8
                        },
                        colors: ["#71B7DD"],
                        plotOptions: {
                            line: {
                                pointPlacement: 'on',
                                lineWidth: 2,
                                marker: {
                                    radius: 3
                                }
                            }
                        },
                        exporting: {
                            enabled: false
                        },
                        credits: {
                            enabled: false
                        },
                        title: {
                            align: 'center',
                            text: "本次变化",
                            x: 30,
                            style: {
                                color: "#eee",
                                fontSize: "16px",
                                fontWeight: "600"
                            }
                        },
                        xAxis: {
                            categories: (function() {
                                return data.map(function(item) {
                                    return item.ringNumber || item.name;
                                });
                            })(),
                            gridLineColor: "#fff",
                            labels: {
                                style: {
                                    color: '#eee'
                                }
                            },
                            tickmarkPlacement: 'on',
                            lineColor: '#aaa'
                        },
                        yAxis: {
                            lineWidth: 1,
                            gridLineColor: "#3E3E40",
                            lineColor: '#fff',
                            title: {
                                text: ''
                            },
                            minTickInterval: 1,
                            labels: {
                                x: -10,
                                style: {
                                    color: '#eee'
                                }
                            }
                        },
                        tooltip: {
                            headerFormat: '<b>{point.key}</b>:',
                            pointFormat: '{point.y}mm'
                        },
                        legend: {
                            enabled: false
                        },
                        series: [{
                            name: ' ',
                            data: (function() {
                                return data.map(function(item) {
                                    return item.value;
                                });
                            })()
                        }]
                    });
                    defer.resolve(null);
                    return defer.promise;
                },
                createAutoSurveyOnePointRecentValues: function(domId, dataSet) {
                    var defer = $q.defer();
                    var chart = $(domId).highcharts();
                    if (chart) {
                        chart.destroy();
                    }
                    var dom = $(domId);
                    defineTheme.dark();
                    $(domId).highcharts({
                        chart: {
                            height: botoomBar_height,
                            type: 'line',
                            borderColor: "transparent",
                            width: dom.width() ? dom.width() : document.body.clientWidth,
                            // width: document.documentElement.clientWidth - 4,
                            style: {
                                fontFamily: '"Microsoft Yahei", Verdana', // default font
                                fontSize: '11px'
                            },
                            spacingLeft: 3,
                            marginTop: 6,
                            spacingRight: 8
                        },
                        colors: ["#71B7DD"],
                        plotOptions: {
                            line: {
                                pointPlacement: 'on',
                                lineWidth: 2,
                                marker: {
                                    radius: 3
                                }
                            }
                        },
                        exporting: {
                            enabled: false
                        },
                        credits: {
                            enabled: false
                        },
                        title: {
                            align: 'center',
                            text: dataSet.name + "(" + dataSet.ringNumber + "环)",
                            x: 30,
                            style: {
                                color: "#eee",
                                fontSize: "16px",
                                fontWeight: "600"
                            }
                        },
                        xAxis: {
                            categories: (function() {
                                return dataSet.list.map(function(item) {
                                    return item.time;
                                });
                            })(),
                            gridLineColor: "#fff",
                            labels: {
                                style: {
                                    color: '#eee'
                                }
                            },
                            tickmarkPlacement: 'on',
                            lineColor: '#aaa'
                        },
                        yAxis: {
                            lineWidth: 1,
                            gridLineColor: "#3E3E40",
                            lineColor: '#fff',
                            title: {
                                text: ''
                            },
                            tickInterval: 0.001,
                            labels: {
                                x: -10,
                                style: {
                                    color: '#eee'
                                }
                            }
                        },
                        tooltip: {
                            headerFormat: '<b>{point.key}</b>:',
                            pointFormat: '{point.y}mm'
                        },
                        legend: {
                            enabled: false
                        },
                        series: [{
                            name: ' ',
                            data: (function() {
                                return dataSet.list.map(function(item) {
                                    return item.value;
                                });
                            })()
                        }]
                    });
                    defer.resolve(null);
                    return defer.promise;
                },
                //用户选择了一系列时间之后,绘制多时间的变化曲线
                createPointsChartListByLocation: function(domId, dataSet, bindMap) {
                    if (typeof(bindMap) === 'undefined') {
                        bindMap = true;
                    }
                    var defer = $q.defer();
                    var dom = $(domId);
                    var chart = dom.highcharts();
                    if (chart) {
                        chart.destroy();
                    }
                    var xAxisInterval = 1,
                        base = 25; //默认的点与点在x坐标轴上的间隔
                    if (!$rootScope.smallScreen) {
                        base = 10;
                    }
                    if (dataSet.dataList[0].length > base * 2) {
                        xAxisInterval = Math.floor(dataSet.dataList[0].length / base) + 3;
                    } else if (dataSet.dataList[0].length > base) {
                        xAxisInterval = Math.floor(dataSet.dataList[0].length / base) + 2;
                    }
                    var pointEvent = bindMap ? {
                        events: {
                            mouseOver: function(event) {
                                var map = mapInstance.getMap();
                                if (map.viewState === 'active') {
                                    var ptName = this.name;
                                    map.fireEvent('makerHoverActive', {
                                        map: map,
                                        ptName: ptName
                                    });
                                }
                            },
                            mouseOut: function(event) {
                                var map = mapInstance.getMap();
                                if (map.viewState === 'active') {
                                    var ptName = this.name;
                                    map.fireEvent('makerHoverInactive', {
                                        map: map,
                                        ptName: ptName
                                    });
                                }
                            },
                            click: function(event) {
                                var ptName = this.name;
                                fac.openSinglePointModal(ptName);
                            }
                        }
                    } : {};
                    var series = dataSet.dataList.map(function(dataItems) {
                        return {
                            name: dataItems[0].time,
                            data: dataItems.map(function(item) {
                                return {
                                    y: item.value,
                                    time: item.time,
                                    name: item.name
                                };
                            })
                        };
                    });
                    $(domId).highcharts({
                        chart: {
                            type: 'line',
                            borderColor: "transparent",
                            width: dom.width() ? dom.width() : document.body.clientWidth,
                            height: botoomBar_height,
                            style: {
                                fontFamily: '"Microsoft Yahei", Verdana', // default font
                                fontSize: '11px'
                            },
                            spacing: [10, 10, 10, 10],
                            margin: [10, 10, 28, 35],
                            backgroundColor: "#333"
                        },
                        colors: ["#E63628", "#71B7DD", "#FFD455", "#49B159", "#ff0066", "#eeaaee"],
                        credits: {
                            enabled: false
                        },
                        exporting: {
                            enabled: false
                        },
                        title: {
                            align: 'left',
                            text: dataSet.title,
                            x: 30,
                            style: {
                                color: "#eee",
                                fontSize: "16px",
                                fontWeight: 800
                            }
                        },
                        xAxis: {
                            type: "category",
                            gridLineColor: "#fff",
                            labels: {
                                style: {
                                    color: '#eee'
                                },
                                step: xAxisInterval,
                                staggerLines: 1
                            },
                            tickmarkPlacement: 'on',
                            lineColor: '#999',
                            tickLength: 4
                        },
                        yAxis: {
                            lineWidth: 1,
                            tickLength: 4,
                            gridLineColor: "#2f2f2f",
                            lineColor: '#999',
                            title: {
                                text: ''
                            },
                            minTickInterval: 1,
                            max: (dataSet.max - dataSet.min > 5) ? dataSet.max + 2 : dataSet.max + 3,
                            min: (dataSet.max - dataSet.min > 5) ? dataSet.min - 2 : dataSet.min - 3,
                            labels: {
                                x: -10,
                                style: {
                                    color: '#eee'
                                }
                            }
                        },
                        legend: {
                            align: 'right',
                            verticalAlign: 'top',
                            floating: true,
                            borderWidth: 0,
                            y: -6
                        },
                        tooltip: {
                            useHTML: true,
                            formatter: function() {
                                return this.point.time + '<br/>' + '<b>' + this.point.name + '</b>:' + toDecimal2(this.point.y) + 'mm';
                            }
                        },
                        plotOptions: {
                            series: {
                                cursor: 'pointer',
                                point: pointEvent,
                                marker: {

                                }
                            }
                        },
                        series: series
                    });
                    defer.resolve(null);
                    return defer.promise;

                },
                createPointsChartByLocation: function(domId, dataSet, bindMap) {
                    fac.botoomBarHeight();
                    if (typeof(bindMap) === 'undefined') {
                        bindMap = true;
                    }
                    var defer = $q.defer();
                    var dom = $(domId);
                    var chart = dom.highcharts();
                    if (chart) {
                        chart.destroy();
                    }
                    defineTheme.dark();
                    var xAxisInterval = 1,
                        base = 25;
                    if ($rootScope.smallScreen) {
                        base = 10;
                    }
                    if (dataSet.lastValues.length > base * 2) {
                        xAxisInterval = Math.floor(dataSet.lastValues.length / base) + 3;
                    } else if (dataSet.lastValues.length > base) {
                        xAxisInterval = Math.floor(dataSet.lastValues.length / base) + 2;
                    }



                    var pointEvent = bindMap ? {
                        events: {
                            mouseOver: function(event) {
                                var map = mapInstance.getMap();
                                if (map.viewState === 'active') {
                                    var ptName = this.category;
                                    map.fireEvent('makerHoverActive', {
                                        map: map,
                                        ptName: ptName
                                    });
                                }
                            },
                            mouseOut: function(event) {
                                var map = mapInstance.getMap();
                                if (map.viewState === 'active') {
                                    var ptName = this.category;
                                    map.fireEvent('makerHoverInactive', {
                                        map: map,
                                        ptName: ptName
                                    });
                                }
                            },
                            click: function(event) {
                                var ptName = this.category;
                                fac.openSinglePointModal(ptName);
                            }
                        }
                    } : {};

                    $(domId).highcharts({
                        chart: {

                            type: 'line',
                            borderColor: "transparent",
                            width: dom.width() ? dom.width() : document.body.clientWidth,
                            height: botoomBar_height,
                            style: {
                                fontFamily: '"Microsoft Yahei", Verdana', // default font
                                fontSize: '11px'
                            },
                            spacing: [10, 10, 10, 10],
                            margin: [10, 10, 28, 35],
                            backgroundColor: "#333"
                        },
                        exporting: {
                            enabled: false
                        },
                        credits: {
                            enabled: false
                        },
                        title: {
                            align: 'left',
                            text: dataSet.title,
                            x: 30,
                            style: {
                                color: "#eee",
                                fontSize: "16px",
                                fontWeight: 800
                            }
                        },
                        xAxis: {
                            categories: (function() {
                                return dataSet.lastValues.map(function(item, index) {
                                    return item.name;
                                });
                            })(),
                            gridLineColor: "#fff",
                            labels: {
                                // rotation: 90,
                                // x: -5,
                                style: {
                                    color: '#eee'
                                },
                                step: xAxisInterval,
                                staggerLines: 1
                            },
                            tickmarkPlacement: 'on',
                            lineColor: '#999',
                            tickLength: 4
                        },
                        yAxis: {
                            lineWidth: 1,
                            tickLength: 4,
                            gridLineColor: "#2f2f2f",
                            lineColor: '#999',
                            title: {
                                text: ''
                            },
                            minTickInterval: 1,
                            max: (dataSet.max - dataSet.min > 5) ? dataSet.max + 2 : dataSet.max + 3,
                            min: (dataSet.max - dataSet.min > 5) ? dataSet.min - 2 : dataSet.min - 3,
                            labels: {
                                x: -10,
                                style: {
                                    color: '#eee'
                                }
                            }
                        },
                        legend: {
                            align: 'right',
                            verticalAlign: 'top',
                            floating: true,
                            borderWidth: 0,
                            y: -6
                        },
                        tooltip: {
                            useHTML: true,
                            formatter: function() {
                                return '<b>' + this.point.category + '</b>:' + toDecimal2(this.point.y) + 'mm';
                            }
                        },
                        plotOptions: {
                            series: {
                                cursor: 'pointer',
                                point: pointEvent,
                                marker: {
                                    lineWidth: 0
                                }
                            }
                        },
                        series: [{
                            name: dataSet.lastTime,
                            data: (function() {
                                return dataSet.lastValues.map(function(item, index) {
                                    return item.value;
                                    // return {
                                    //     y: item.value,
                                    //     x: item.name
                                    // };
                                });
                            })()
                        }, {
                            name: dataSet.curTime,
                            data: (function() {
                                return dataSet.curValues.map(function(item, index) {
                                    return item.value;
                                });
                            })()
                        }]
                    });
                    defer.resolve(null);
                    return defer.promise;
                },
                createPointsChartByLocationSummary: function(domId, dataSet, width, height) {

                    var defer = $q.defer();
                    var dom = $(domId);
                    var chart = dom.highcharts();
                    if (chart) {
                        chart.destroy();
                    }
                    defineTheme.light();
                    var xAxisInterval = 1,
                        base = 25;
                    if ($rootScope.smallScreen) {
                        base = 10;
                    }
                    if (dataSet.lastValues.length > base * 2) {
                        xAxisInterval = Math.floor(dataSet.lastValues.length / base) + 3;
                    } else if (dataSet.lastValues.length > base) {
                        xAxisInterval = Math.floor(dataSet.lastValues.length / base) + 2;
                    }

                    var pointEvent = {
                        events: {
                            click: function(event) {
                                var ptName = this.category;
                                fac.openSinglePointModal(ptName);
                            }
                        }
                    };

                    $(domId).highcharts({
                        chart: {
                            type: 'line',
                            borderColor: "#2D7C7C",
                            borderWidth: 0,
                            height: $rootScope.smallScreen ? 250 : 400,
                            style: {
                                fontFamily: '"Microsoft Yahei", Verdana', // default font
                                fontSize: '11px',
                                borderTopLeftRadius: "0px",
                                borderTopRightRadius: "0px",
                                borderBottomLeftRadius: "5px",
                                borderBottomRightRadius: "5px"
                                    // borderTop: "5px solid #2D7C7C",
                            },
                            spacing: [40, 40, 40, 40],
                            margin: [30, 30, 50, 50],
                            backgroundColor: "rgb(255,255,255)",
                            borderRadius: 0
                        },
                        exporting: {
                            enabled: false
                        },
                        credits: {
                            enabled: false
                        },
                        title: {
                            align: 'left',
                            text: "",
                            x: 30
                        },
                        xAxis: {
                            categories: (function() {
                                return dataSet.lastValues.map(function(item, index) {
                                    return item.name;
                                });
                            })(),
                            gridLineColor: "transparent",
                            labels: {
                                style: {
                                    color: '#555',
                                    font: '12px'
                                },
                                step: xAxisInterval,
                                staggerLines: 1
                            },
                            tickmarkPlacement: 'on',
                            lineColor: '#444',
                            tickLength: 4
                        },
                        yAxis: {
                            lineWidth: 1,
                            tickLength: 4,
                            gridLineColor: "#f0f0f0",
                            lineColor: '#444',
                            title: {
                                text: ''
                            },
                            minTickInterval: 1,
                            max: (dataSet.max - dataSet.min > 5) ? dataSet.max + 2 : dataSet.max + 3,
                            min: (dataSet.max - dataSet.min > 5) ? dataSet.min - 2 : dataSet.min - 3,
                            labels: {
                                x: -3,
                                style: {
                                    color: '#444',
                                    font: '12px'
                                }
                            }
                        },
                        legend: {
                            align: 'right',
                            verticalAlign: 'top',
                            floating: true,
                            borderWidth: 0,
                            y: -6
                        },
                        tooltip: {
                            headerFormat: '<b>{point.x}</b>:',
                            pointFormat: '{point.y}mm'
                        },
                        plotOptions: {
                            line: {
                                lineWidth: 1,
                                marker: {
                                    radius: 2
                                }
                            },
                            series: {
                                cursor: 'pointer',
                                point: pointEvent,
                                marker: {
                                    lineWidth: 0
                                }
                            }
                        },
                        series: [{
                            name: dataSet.lastTime,
                            data: (function() {
                                return dataSet.lastValues.map(function(item, index) {
                                    return {
                                        name: item.name,
                                        y: item.value,
                                        marker: (function() {
                                            if (item.name === dataSet.maxPointAllTheTime.name) {
                                                return {
                                                    lineWidth: 1,
                                                    enabled: true,
                                                    lineColor: "#111",
                                                    radius: 5
                                                };
                                            } else if (item.name === dataSet.maxPointThisTime.name) {
                                                return {
                                                    enabled: true,
                                                    radius: 5
                                                };
                                            } else {
                                                return {
                                                    enabled: true,
                                                    radius: 2
                                                };
                                            }
                                        })()
                                    };
                                });
                            })()
                        }, {
                            name: dataSet.curTime,
                            data: (function() {
                                return dataSet.curValues.map(function(item, index) {
                                    return {
                                        name: item.name,
                                        y: item.value,
                                        marker: (function() {
                                            if (item.name === dataSet.maxPointAllTheTime.name) {
                                                return {
                                                    lineWidth: 1,
                                                    lineColor: "#111",
                                                    enabled: true,
                                                    radius: 5
                                                };
                                            } else if (item.name === dataSet.maxPointThisTime.name) {
                                                return {
                                                    enabled: true,
                                                    radius: 5
                                                };
                                            } else {
                                                return {
                                                    enabled: true,
                                                    radius: 2
                                                };
                                            }
                                        })()
                                    };
                                });
                            })()
                        }]
                    });
                    defer.resolve(null);
                    return defer.promise;
                },
                openSinglePointModal: function(pointName) {
                    var singleChange = null;
                    var prj = $rootScope.curPrj;
                    prj.getSinglePointRecentChanges(pointName).then(function(data) {
                        singleChange = data;
                        var content = $('#singleChartModalCotent').empty();
                        var chartDiv = document.createElement('div');
                        chartDiv.setAttribute('data-point-Name', pointName);
                        chartDiv.setAttribute('data-start-Date', singleChange[0].time.toString());
                        chartDiv.setAttribute('data-end-Date', singleChange[singleChange.length - 1].time.toString());
                        chartDiv.setAttribute('data-single-point-query', '');
                        chartDiv.setAttribute('id', "singlePointQuery");
                        content[0].appendChild(chartDiv);
                        $compile(angular.element(chartDiv))($rootScope);
                        return $timeout(function() {}, 10);
                    }).then(function() {
                        var modal = $('#singleChartModal');
                        modal.modal({
                            detachable: false,
                            onVisible: function() {}
                        });
                        return $timeout(function() {
                            modal.modal('show');
                        }, 300);
                    }).then(function() {
                        return fac.createSinglePointChangesChart('#singleChart', singleChange);
                    });
                },
                createSinglePointChangesChart: function(domId, dataSet) {
                    var defer = $q.defer();
                    defineTheme.transparent();
                    var interval = dataSet.length < 10 ? 1 : Math.round(dataSet.length / 5);
                    var chart = $(domId).highcharts();
                    if (chart) {
                        chart.destroy();
                    }
                    chart = $(domId).highcharts({
                        chart: {
                            type: 'line',
                            spacingLeft: 30,
                            spacingRight: 30,

                            margin: [30, 10, 40, 40],
                        },
                        exporting: {
                            enabled: false
                        },
                        credits: {
                            enabled: false
                        },
                        title: {
                            align: 'center',
                            text: dataSet[0].name,
                            y: 32
                        },
                        xAxis: {
                            categories: (function() {
                                return dataSet.map(function(item) {
                                    return item.time;
                                });
                            })(),
                            tickmarkPlacement: 'on',
                            tickInterval: interval,
                            tickLength: 4
                        },
                        yAxis: {
                            lineWidth: 0,
                            tickLength: 0,
                            gridLineWidth: 1,
                            gridLineColor: "#3f3f3f",
                            tickColor: '#999',
                            lineColor: '#999',
                            title: {
                                text: ''
                            },
                            tickInterval: 1,
                        },
                        legend: {
                            enabled: false
                        },
                        tooltip: {
                            headerFormat: '<b>{point.key}</b>:',
                            pointFormat: '{point.y}mm'
                        },
                        plotOptions: {
                            series: {
                                cursor: 'pointer',
                                marker: {
                                    lineWidth: 1
                                }
                            }
                        },
                        series: [{
                            name: '1',
                            data: (function() {
                                return dataSet.map(function(item) {
                                    return item.value;
                                });
                            })()
                        }]
                    });
                    defer.resolve(null);
                    return defer.promise;
                },
                exportChart: function(domId, exportType) {
                    var chart = $('#' + domId).highcharts();
                    if (exportType === 'pic') {
                        chart.exportChart({
                            type: "image/png",
                            url: "/exportChart",
                            downloadName: $rootScope.curPrj.name + "-" + chart.title.textStr + '.png'
                        });
                    } else if (exportType === 'pdf') {
                        chart.exportChart({
                            type: "application/pdf",
                            url: "/exportChart",
                            downloadName: $rootScope.curPrj.name + "-" + chart.title.textStr + '.pdf'
                        });
                    } else if (exportType === 'whitePic') {
                        //重写白色的样式
                        var chartLigthStyle = {
                            colors: ['#E94E51', '#0FBDFF', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
                            chart: {
                                backgroundColor: "#fff",
                                borderColor: 'transparent',
                                borderWidth: 1,
                                borderRadius: 0,
                                plotBackgroundColor: 'transparent',
                                plotBorderColor: 'transparent',
                                spacing: [10, 10, 10, 10],
                                margin: [10, 10, 28, 35],
                                style: {
                                    fontFamily: '"Microsoft Yahei", Verdana', // default font
                                    fontSize: '11px',
                                    color: '#4E5043'
                                }
                            },
                            title: {
                                style: {
                                    color: '#272727',
                                    font: '16px'
                                }
                            },
                            xAxis: [{
                                type: "category",
                                categories: chart.xAxis[0].categories,
                                gridLineColor: 'transparent',
                                gridLineWidth: 0,
                                lineColor: '#515346',
                                tickColor: '#515346',
                                tickmarkPlacement: 'on',
                                tickLength: 4,
                                labels: {
                                    step: chart.xAxis[0].userOptions.labels.step,
                                    staggerLines: 1,
                                    style: {
                                        color: '#424338',
                                        font: '12px'
                                    }
                                }
                            }],
                            yAxis: [{
                                gridLineColor: '#f1f1f1',
                                gridLineWidth: 1,
                                lineColor: '#515346',
                                lineWidth: 1,
                                minTickInterval: 1,
                                tickLength: 4,
                                tickInterval: chart.yAxis[0].tickInterval,
                                max: chart.yAxis[0].max,
                                min: chart.yAxis[0].min,
                                tickColor: '#515346',
                                labels: {
                                    style: {
                                        color: '#424338',
                                        fontSize: '12px'
                                    }
                                }
                            }],
                            legend: {
                                itemStyle: {
                                    color: '#282923',
                                    "fontWeight": "bold"
                                },
                            },
                            plotOptions: {
                                line: {
                                    lineWidth: 1,
                                    marker: {
                                        radius: 3
                                    }
                                }
                            }
                        };
                        chart.exportChart({
                            type: "image/png",
                            url: "/exportChart",
                            downloadName: $rootScope.curPrj.name + "-" + chart.title.textStr + '.png'
                        }, chartLigthStyle);
                    }
                }
            };
            return fac;
        }
    ]);
});
